const winston = require('winston');
const config = require('../config/default.json');

// 创建统一的日志实例
const logger = winston.createLogger({
  level: config.logging.level,
  format: winston.format.combine(
    winston.format.timestamp(),
    winston.format.json()
  ),
  transports: [
    new winston.transports.File({ 
      filename: config.logging.file,
      maxFiles: config.logging.maxFiles,
      maxsize: config.logging.maxSize
    }),
    new winston.transports.Console({
      format: winston.format.simple()
    })
  ]
});

module.exports = logger;